home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 02 - 1986 / 02.09 Sep 86.sit / 02.09 Sep 86 / PAPDriver source / PAPdrvr.c < prev   
MacBinary  |  1986-07-18  |  4.3 KB  |  [TEXT/KAHL]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Fri Jul 18 12:31:00 1986, modified Fri Jul 18 12:31:00 1986, creator Think C, type ASCII, 3717 bytes "PAPdrvr.c" , at 0xf05 348 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[KAHL]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 09 50 41 50 64 72 76 | 72 2e 63 00 00 00 00 00 |..PAPdrv|r.c.....|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4b 41 48 | 4c 01 00 00 00 00 00 00 |.TEXTKAH|L.......|
|00000050| 00 00 00 00 00 0e 85 00 | 00 01 5c 9b 44 1f c4 9b |........|..\.D...|
|00000060| 44 1f c4 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |D.......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 07 4d 00 00 |........|.....M..|
|00000080| 2f 2a 0d 20 2a 09 50 41 | 50 20 44 72 69 76 65 72 |/*. *.PA|P Driver|
|00000090| 0d 20 2a 0d 20 2a 20 54 | 68 69 73 20 64 72 69 76 |. *. * T|his driv|
|000000a0| 65 72 20 61 6c 6c 6f 77 | 73 20 61 70 70 6c 69 63 |er allow|s applic|
|000000b0| 61 74 69 6f 6e 73 2c 20 | 65 74 63 2e 20 74 6f 20 |ations, |etc. to |
|000000c0| 63 6f 6d 6d 75 6e 69 63 | 61 74 65 20 77 69 74 68 |communic|ate with|
|000000d0| 20 74 68 65 0d 20 2a 20 | 63 75 72 72 65 6e 74 6c | the. * |currentl|
|000000e0| 79 20 73 65 6c 65 63 74 | 65 64 20 4c 61 73 65 72 |y select|ed Laser|
|000000f0| 57 72 69 74 65 72 20 76 | 69 61 20 73 74 61 6e 64 |Writer v|ia stand|
|00000100| 61 72 64 20 4d 61 63 20 | 49 2f 4f 20 63 61 6c 6c |ard Mac |I/O call|
|00000110| 73 2e 0d 20 2a 2f 0d 0d | 2f 2a 20 6d 61 63 69 6e |s.. */..|/* macin|
|00000120| 74 6f 73 68 20 68 65 61 | 64 65 72 73 20 2a 2f 0d |tosh hea|ders */.|
|00000130| 23 69 6e 63 6c 75 64 65 | 20 3c 44 65 76 69 63 65 |#include| <Device|
|00000140| 4d 67 72 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |Mgr.h>.#|include |
|00000150| 3c 46 69 6c 65 4d 67 72 | 2e 68 3e 0d 0d 0d 2f 2a |<FileMgr|.h>.../*|
|00000160| 20 6e 2d 62 69 74 20 73 | 69 67 6e 65 64 20 69 6e | n-bit s|igned in|
|00000170| 74 65 67 65 72 73 20 2a | 2f 0d 23 64 65 66 69 6e |tegers *|/.#defin|
|00000180| 65 20 69 6e 74 31 36 20 | 69 6e 74 0d 23 64 65 66 |e int16 |int.#def|
|00000190| 69 6e 65 20 69 6e 74 33 | 32 20 6c 6f 6e 67 0d 0d |ine int3|2 long..|
|000001a0| 74 79 70 65 64 65 66 20 | 73 74 72 75 63 74 09 09 |typedef |struct..|
|000001b0| 09 09 09 2f 2a 20 70 61 | 70 20 73 74 61 74 75 73 |.../* pa|p status|
|000001c0| 20 72 65 63 6f 72 64 20 | 2a 2f 0d 09 7b 0d 09 69 | record |*/..{..i|
|000001d0| 6e 74 33 32 20 73 79 73 | 74 65 6d 53 74 75 66 66 |nt32 sys|temStuff|
|000001e0| 3b 0d 09 63 68 61 72 20 | 73 74 61 74 75 73 53 74 |;..char |statusSt|
|000001f0| 72 5b 32 35 36 5d 3b 0d | 09 7d 20 70 61 70 53 74 |r[256];.|.} papSt|
|00000200| 61 74 75 73 52 65 63 2c | 20 2a 70 61 70 53 74 61 |atusRec,| *papSta|
|00000210| 74 75 73 50 74 72 3b 0d | 0d 69 6e 74 31 36 20 70 |tusPtr;.|.int16 p|
|00000220| 72 65 66 6e 75 6d 3b 09 | 09 09 09 09 2f 2a 20 70 |refnum;.|..../* p|
|00000230| 61 70 20 72 65 66 4e 75 | 6d 20 2a 2f 0d 48 61 6e |ap refNu|m */.Han|
|00000240| 64 6c 65 20 65 6e 74 69 | 74 79 3b 09 09 09 09 09 |dle enti|ty;.....|
|00000250| 2f 2a 20 68 61 6e 64 6c | 65 20 74 6f 20 73 65 72 |/* handl|e to ser|
|00000260| 76 65 72 20 65 6e 74 69 | 74 79 20 6e 61 6d 65 20 |ver enti|ty name |
|00000270| 2a 2f 0d 70 61 70 53 74 | 61 74 75 73 52 65 63 20 |*/.papSt|atusRec |
|00000280| 73 74 61 74 75 73 3b 09 | 09 09 2f 2a 20 70 61 70 |status;.|../* pap|
|00000290| 20 73 74 61 74 75 73 20 | 2a 2f 0d 0d 63 68 61 72 | status |*/..char|
|000002a0| 20 72 62 75 66 66 5b 35 | 31 32 5d 3b 09 09 09 09 | rbuff[5|12];....|
|000002b0| 2f 2a 20 72 65 61 64 20 | 62 75 66 66 65 72 20 2a |/* read |buffer *|
|000002c0| 2f 0d 69 6e 74 31 36 20 | 72 73 69 7a 65 3b 09 09 |/.int16 |rsize;..|
|000002d0| 09 09 09 2f 2a 20 72 65 | 61 64 20 73 69 7a 65 20 |.../* re|ad size |
|000002e0| 2a 2f 0d 69 6e 74 31 36 | 20 72 73 74 61 74 65 3b |*/.int16| rstate;|
|000002f0| 09 09 09 09 09 2f 2a 20 | 53 74 61 74 75 73 20 6f |...../* |Status o|
|00000300| 66 20 50 41 50 52 65 61 | 64 20 2a 2f 0d 69 6e 74 |f PAPRea|d */.int|
|00000310| 31 36 20 72 65 6f 66 3b | 09 09 09 09 09 09 2f 2a |16 reof;|....../*|
|00000320| 20 53 65 74 20 74 6f 20 | 72 65 61 64 20 45 4f 46 | Set to |read EOF|
|00000330| 20 73 74 61 74 75 73 20 | 2a 2f 0d 0d 65 78 74 65 | status |*/..exte|
|00000340| 72 6e 20 70 61 73 63 61 | 6c 20 69 6e 74 31 36 20 |rn pasca|l int16 |
|00000350| 70 61 70 4f 70 65 6e 28 | 29 3b 0d 65 78 74 65 72 |papOpen(|);.exter|
|00000360| 6e 20 70 61 73 63 61 6c | 20 69 6e 74 31 36 20 70 |n pascal| int16 p|
|00000370| 61 70 52 65 61 64 28 29 | 3b 0d 65 78 74 65 72 6e |apRead()|;.extern|
|00000380| 20 70 61 73 63 61 6c 20 | 69 6e 74 31 36 20 70 61 | pascal |int16 pa|
|00000390| 70 57 72 69 74 65 28 29 | 3b 0d 65 78 74 65 72 6e |pWrite()|;.extern|
|000003a0| 20 70 61 73 63 61 6c 20 | 69 6e 74 31 36 20 70 61 | pascal |int16 pa|
|000003b0| 70 53 74 61 74 75 73 28 | 29 3b 0d 65 78 74 65 72 |pStatus(|);.exter|
|000003c0| 6e 20 70 61 73 63 61 6c | 20 69 6e 74 31 36 20 70 |n pascal| int16 p|
|000003d0| 61 70 43 6c 6f 73 65 28 | 29 3b 0d 65 78 74 65 72 |apClose(|);.exter|
|000003e0| 6e 20 70 61 73 63 61 6c | 20 48 61 6e 64 6c 65 20 |n pascal| Handle |
|000003f0| 70 61 70 4c 6f 61 64 28 | 29 3b 0d 65 78 74 65 72 |papLoad(|);.exter|
|00000400| 6e 20 70 61 73 63 61 6c | 20 69 6e 74 31 36 20 70 |n pascal| int16 p|
|00000410| 61 70 55 6e 6c 6f 61 64 | 28 29 3b 0d 0d 2f 2a 20 |apUnload|();../* |
|00000420| 0d 20 2a 20 44 72 69 76 | 65 72 20 44 69 73 70 61 |. * Driv|er Dispa|
|00000430| 74 63 68 20 72 6f 75 74 | 69 6e 65 0d 20 2a 2f 0d |tch rout|ine. */.|
|00000440| 4f 53 45 72 72 20 6d 61 | 69 6e 28 70 62 2c 20 64 |OSErr ma|in(pb, d|
|00000450| 63 65 2c 20 6f 70 29 0d | 44 43 74 6c 45 6e 74 72 |ce, op).|DCtlEntr|
|00000460| 79 20 2a 64 63 65 3b 0d | 69 6f 50 61 72 61 6d 20 |y *dce;.|ioParam |
|00000470| 2a 70 62 3b 0d 69 6e 74 | 20 6f 70 3b 0d 09 7b 0d |*pb;.int| op;..{.|
|00000480| 09 73 77 69 74 63 68 28 | 6f 70 29 0d 09 09 7b 0d |.switch(|op)...{.|
|00000490| 09 09 63 61 73 65 20 30 | 3a 09 09 09 09 2f 2a 20 |..case 0|:..../* |
|000004a0| 4f 70 65 6e 20 2a 2f 0d | 09 09 09 72 65 74 75 72 |Open */.|...retur|
|000004b0| 6e 28 64 72 76 72 6f 70 | 65 6e 28 64 63 65 2c 20 |n(drvrop|en(dce, |
|000004c0| 70 62 29 29 3b 0d 09 09 | 63 61 73 65 20 31 3a 09 |pb));...|case 1:.|
|000004d0| 09 09 09 2f 2a 20 50 72 | 69 6d 65 20 2a 2f 0d 09 |.../* Pr|ime */..|
|000004e0| 09 09 72 65 74 75 72 6e | 28 64 72 76 72 70 72 69 |..return|(drvrpri|
|000004f0| 6d 65 28 64 63 65 2c 20 | 70 62 29 29 3b 0d 09 09 |me(dce, |pb));...|
|00000500| 63 61 73 65 20 32 3a 09 | 09 09 09 2f 2a 20 43 6f |case 2:.|.../* Co|
|00000510| 6e 74 72 6f 6c 20 2a 2f | 0d 09 09 09 72 65 74 75 |ntrol */|....retu|
|00000520| 72 6e 28 64 72 76 72 63 | 74 6c 28 64 63 65 2c 20 |rn(drvrc|tl(dce, |
|00000530| 70 62 29 29 3b 0d 09 09 | 63 61 73 65 20 33 3a 09 |pb));...|case 3:.|
|00000540| 09 09 09 2f 2a 20 53 74 | 61 74 75 73 20 2a 2f 0d |.../* St|atus */.|
|00000550| 09 09 09 72 65 74 75 72 | 6e 28 64 72 76 72 73 74 |...retur|n(drvrst|
|00000560| 61 74 75 73 28 64 63 65 | 2c 20 70 62 29 29 3b 0d |atus(dce|, pb));.|
|00000570| 09 09 63 61 73 65 20 34 | 3a 09 09 09 09 2f 2a 20 |..case 4|:..../* |
|00000580| 43 6c 6f 73 65 20 2a 2f | 0d 09 09 09 72 65 74 75 |Close */|....retu|
|00000590| 72 6e 28 64 72 76 72 63 | 6c 6f 73 65 28 64 63 65 |rn(drvrc|lose(dce|
|000005a0| 2c 20 70 62 29 29 3b 0d | 09 09 64 65 66 61 75 6c |, pb));.|..defaul|
|000005b0| 74 3a 0d 09 09 09 3b 0d | 09 09 7d 0d 09 7d 0d 0d |t:....;.|..}..}..|
|000005c0| 0d 2f 2a 0d 20 2a 20 4f | 70 65 6e 0d 20 2a 2f 0d |./*. * O|pen. */.|
|000005d0| 69 6e 74 31 36 20 64 72 | 76 72 6f 70 65 6e 28 64 |int16 dr|vropen(d|
|000005e0| 63 65 2c 20 70 62 29 0d | 09 44 43 74 6c 45 6e 74 |ce, pb).|.DCtlEnt|
|000005f0| 72 79 20 2a 64 63 65 3b | 0d 09 69 6f 50 61 72 61 |ry *dce;|..ioPara|
|00000600| 6d 20 2a 70 62 3b 0d 09 | 7b 0d 09 69 6e 74 31 36 |m *pb;..|{..int16|
|00000610| 20 6f 73 74 61 74 65 3b | 0d 09 69 6e 74 31 36 20 | ostate;|..int16 |
|00000620| 70 72 65 73 3b 0d 09 69 | 6e 74 31 36 20 64 72 76 |pres;..i|nt16 drv|
|00000630| 72 63 6c 6f 73 65 28 29 | 3b 0d 09 0d 09 64 63 65 |rclose()|;....dce|
|00000640| 2d 3e 64 43 74 6c 46 6c | 61 67 73 20 7c 3d 20 64 |->dCtlFl|ags |= d|
|00000650| 4e 65 65 64 47 6f 6f 64 | 42 79 65 20 7c 20 64 4e |NeedGood|Bye | dN|
|00000660| 65 65 64 54 69 6d 65 3b | 0d 09 64 63 65 2d 3e 64 |eedTime;|..dce->d|
|00000670| 43 74 6c 46 6c 61 67 73 | 20 26 3d 20 7e 64 52 65 |CtlFlags| &= ~dRe|
|00000680| 61 64 45 6e 61 62 6c 65 | 3b 09 09 2f 2a 20 4e 6f |adEnable|;../* No|
|00000690| 20 52 65 61 64 20 66 6f | 72 20 6e 6f 77 20 2a 2f | Read fo|r now */|
|000006a0| 0d 09 64 63 65 2d 3e 64 | 43 74 6c 46 6c 61 67 73 |..dce->d|CtlFlags|
|000006b0| 20 26 3d 20 7e 64 53 74 | 61 74 45 6e 61 62 6c 65 | &= ~dSt|atEnable|
|000006c0| 3b 09 09 2f 2a 20 4e 6f | 20 53 74 61 74 75 73 20 |;../* No| Status |
|000006d0| 66 6f 72 20 6e 6f 77 20 | 2a 2f 0d 09 64 63 65 2d |for now |*/..dce-|
|000006e0| 3e 64 43 74 6c 44 65 6c | 61 79 20 3d 20 31 32 3b |>dCtlDel|ay = 12;|
|000006f0| 09 09 09 09 2f 2a 20 35 | 20 48 7a 2e 20 63 79 63 |..../* 5| Hz. cyc|
|00000700| 6c 65 20 72 61 74 65 20 | 2a 2f 0d 09 72 73 74 61 |le rate |*/..rsta|
|00000710| 74 65 20 3d 20 31 3b 09 | 09 09 09 09 09 09 2f 2a |te = 1;.|....../*|
|00000720| 20 44 69 73 61 62 6c 65 | 20 35 20 48 7a 20 72 65 | Disable| 5 Hz re|
|00000730| 61 64 73 20 66 6f 72 20 | 6e 6f 77 20 2a 2f 0d 09 |ads for |now */..|
|00000740| 0d 09 70 72 65 73 20 3d | 20 6e 6f 45 72 72 3b 0d |..pres =| noErr;.|
|00000750| 09 65 6e 74 69 74 79 20 | 3d 20 30 3b 09 09 09 09 |.entity |= 0;....|
|00000760| 09 09 09 2f 2a 20 50 41 | 50 20 6e 6f 74 20 6c 6f |.../* PA|P not lo|
|00000770| 61 64 65 64 20 2a 2f 0d | 09 70 72 65 66 6e 75 6d |aded */.|.prefnum|
|00000780| 20 3d 20 2d 31 3b 09 09 | 09 09 09 09 2f 2a 20 4e | = -1;..|..../* N|
|00000790| 6f 20 63 6f 6e 6e 65 63 | 74 69 6f 6e 20 2a 2f 0d |o connec|tion */.|
|000007a0| 09 69 66 28 65 6e 74 69 | 74 79 20 3d 20 70 61 70 |.if(enti|ty = pap|
|000007b0| 4c 6f 61 64 28 29 29 0d | 09 09 7b 0d 09 09 73 74 |Load()).|..{...st|
|000007c0| 61 74 75 73 2e 73 74 61 | 74 75 73 53 74 72 5b 30 |atus.sta|tusStr[0|
|000007d0| 5d 20 3d 20 27 5c 30 27 | 3b 09 09 2f 2a 20 43 6c |] = '\0'|;../* Cl|
|000007e0| 65 61 72 20 73 74 61 74 | 75 73 20 73 74 72 69 6e |ear stat|us strin|
|000007f0| 67 20 2a 2f 0d 09 09 69 | 66 28 28 70 72 65 73 20 |g */...i|f((pres |
|00000800| 3d 20 70 61 70 4f 70 65 | 6e 28 26 70 72 65 66 6e |= papOpe|n(&prefn|
|00000810| 75 6d 2c 20 2a 65 6e 74 | 69 74 79 2c 20 31 2c 20 |um, *ent|ity, 1, |
|00000820| 26 73 74 61 74 75 73 2c | 20 26 6f 73 74 61 74 65 |&status,| &ostate|
|00000830| 29 29 20 3d 3d 20 6e 6f | 45 72 72 29 0d 09 09 09 |)) == no|Err)....|
|00000840| 7b 0d 09 09 09 77 68 69 | 6c 65 28 6f 73 74 61 74 |{....whi|le(ostat|
|00000850| 65 20 3e 20 30 29 09 09 | 09 09 0d 09 09 09 09 3b |e > 0)..|.......;|
|00000860| 0d 09 09 09 70 72 65 73 | 20 3d 20 6f 73 74 61 74 |....pres| = ostat|
|00000870| 65 3b 0d 09 09 09 7d 0d | 09 09 7d 0d 09 65 6c 73 |e;....}.|..}..els|
|00000880| 65 0d 09 09 70 72 65 73 | 20 3d 20 6f 70 65 6e 45 |e...pres| = openE|
|00000890| 72 72 3b 0d 0d 09 69 66 | 28 70 72 65 73 20 21 3d |rr;...if|(pres !=|
|000008a0| 20 6e 6f 45 72 72 29 0d | 09 09 7b 0d 09 09 70 72 | noErr).|..{...pr|
|000008b0| 65 66 6e 75 6d 20 3d 20 | 2d 31 3b 09 09 09 09 09 |efnum = |-1;.....|
|000008c0| 2f 2a 20 50 41 50 20 63 | 6f 6e 6e 65 63 74 69 6f |/* PAP c|onnectio|
|000008d0| 6e 20 6e 6f 74 20 6f 70 | 65 6e 20 2a 2f 0d 09 09 |n not op|en */...|
|000008e0| 64 72 76 72 63 6c 6f 73 | 65 28 64 63 65 2c 20 70 |drvrclos|e(dce, p|
|000008f0| 62 29 3b 0d 09 09 7d 0d | 09 65 6c 73 65 0d 09 09 |b);...}.|.else...|
|00000900| 70 61 70 52 65 61 64 28 | 70 72 65 66 6e 75 6d 2c |papRead(|prefnum,|
|00000910| 20 72 62 75 66 66 2c 20 | 26 72 73 69 7a 65 2c 20 | rbuff, |&rsize, |
|00000920| 26 72 65 6f 66 2c 20 26 | 72 73 74 61 74 65 29 3b |&reof, &|rstate);|
|00000930| 0d 09 09 0d 09 72 65 74 | 75 72 6e 28 70 72 65 73 |.....ret|urn(pres|
|00000940| 29 3b 0d 09 7d 0d 0d 2f | 2a 0d 20 2a 20 43 6c 6f |);..}../|*. * Clo|
|00000950| 73 65 0d 20 2a 2f 0d 69 | 6e 74 31 36 20 64 72 76 |se. */.i|nt16 drv|
|00000960| 72 63 6c 6f 73 65 28 64 | 63 65 2c 20 70 62 29 0d |rclose(d|ce, pb).|
|00000970| 09 44 43 74 6c 45 6e 74 | 72 79 20 2a 64 63 65 3b |.DCtlEnt|ry *dce;|
|00000980| 0d 09 69 6f 50 61 72 61 | 6d 20 2a 70 62 3b 0d 09 |..ioPara|m *pb;..|
|00000990| 7b 0d 09 69 6e 74 31 36 | 20 70 72 65 73 3b 0d 09 |{..int16| pres;..|
|000009a0| 69 6e 74 31 36 20 77 73 | 74 61 74 65 3b 0d 09 0d |int16 ws|tate;...|
|000009b0| 09 70 72 65 73 20 3d 20 | 6e 6f 45 72 72 3b 0d 09 |.pres = |noErr;..|
|000009c0| 0d 09 69 66 20 28 70 72 | 65 66 6e 75 6d 20 3e 3d |..if (pr|efnum >=|
|000009d0| 20 30 29 0d 09 09 7b 0d | 09 09 2f 2a 20 45 78 63 | 0)...{.|../* Exc|
|000009e0| 68 61 6e 67 65 20 45 4f | 46 20 6d 65 73 73 61 67 |hange EO|F messag|
|000009f0| 65 73 2c 20 74 68 65 6e | 20 63 6c 6f 73 65 20 2a |es, then| close *|
|00000a00| 2f 0d 09 09 69 66 28 28 | 70 72 65 73 20 3d 20 70 |/...if((|pres = p|
|00000a10| 61 70 57 72 69 74 65 28 | 70 72 65 66 6e 75 6d 2c |apWrite(|prefnum,|
|00000a20| 20 22 22 2c 20 30 2c 20 | 31 2c 20 26 77 73 74 61 | "", 0, |1, &wsta|
|00000a30| 74 65 29 29 20 3d 3d 20 | 6e 6f 45 72 72 29 0d 09 |te)) == |noErr)..|
|00000a40| 09 09 7b 0d 09 09 09 77 | 68 69 6c 65 28 77 73 74 |..{....w|hile(wst|
|00000a50| 61 74 65 20 3e 20 30 29 | 0d 09 09 09 09 3b 0d 09 |ate > 0)|.....;..|
|00000a60| 09 09 77 68 69 6c 65 28 | 72 73 74 61 74 65 20 3e |..while(|rstate >|
|00000a70| 20 30 29 0d 09 09 09 09 | 3b 0d 09 09 09 7d 0d 09 | 0).....|;....}..|
|00000a80| 09 70 72 65 73 20 3d 20 | 70 61 70 43 6c 6f 73 65 |.pres = |papClose|
|00000a90| 28 70 72 65 66 6e 75 6d | 29 3b 0d 09 09 7d 0d 0d |(prefnum|);...}..|
|00000aa0| 09 69 66 28 65 6e 74 69 | 74 79 20 21 3d 20 30 29 |.if(enti|ty != 0)|
|00000ab0| 0d 09 09 70 72 65 73 20 | 3d 20 70 61 70 55 6e 6c |...pres |= papUnl|
|00000ac0| 6f 61 64 28 29 3b 0d 0d | 09 72 65 74 75 72 6e 28 |oad();..|.return(|
|00000ad0| 70 72 65 73 29 3b 0d 09 | 7d 0d 0d 2f 2a 0d 20 2a |pres);..|}../*. *|
|00000ae0| 20 43 6f 6e 74 72 6f 6c | 0d 20 2a 0d 20 2a 20 43 | Control|. *. * C|
|00000af0| 61 6c 6c 65 64 20 61 74 | 20 32 48 7a 20 61 6e 64 |alled at| 2Hz and|
|00000b00| 20 66 6f 72 20 6e 65 65 | 64 47 6f 6f 64 42 79 65 | for nee|dGoodBye|
|00000b10| 2c 20 61 6c 73 6f 20 63 | 61 6c 6c 65 64 20 64 75 |, also c|alled du|
|00000b20| 72 69 6e 67 20 77 61 69 | 74 20 6c 6f 6f 70 0d 20 |ring wai|t loop. |
|00000b30| 2a 20 69 6e 20 74 68 65 | 20 27 77 72 69 74 65 27 |* in the| 'write'|
|00000b40| 20 72 6f 75 74 69 6e 65 | 2c 20 73 69 6e 63 65 20 | routine|, since |
|00000b50| 73 6f 6d 65 20 61 70 70 | 73 20 64 6f 6e 27 74 20 |some app|s don't |
|00000b60| 63 61 6c 6c 20 53 79 73 | 74 65 6d 54 61 73 6b 0d |call Sys|temTask.|
|00000b70| 20 2a 20 28 6e 61 6d 65 | 6c 79 20 53 6d 61 6c 6c | * (name|ly Small|
|00000b80| 74 61 6c 6b 2d 38 30 21 | 29 2e 0d 20 2a 2f 0d 69 |talk-80!|).. */.i|
|00000b90| 6e 74 31 36 20 64 72 76 | 72 63 74 6c 28 64 63 65 |nt16 drv|rctl(dce|
|00000ba0| 2c 20 70 62 29 0d 09 44 | 43 74 6c 45 6e 74 72 79 |, pb)..D|CtlEntry|
|00000bb0| 20 2a 64 63 65 3b 0d 09 | 63 6e 74 72 6c 50 61 72 | *dce;..|cntrlPar|
|00000bc0| 61 6d 20 2a 70 62 3b 0d | 09 7b 0d 09 0d 09 2f 2a |am *pb;.|.{..../*|
|00000bd0| 20 49 66 20 67 6f 6f 64 | 42 79 65 2c 20 73 68 75 | If good|Bye, shu|
|00000be0| 74 20 64 6f 77 6e 20 2a | 2f 0d 09 69 66 28 70 62 |t down *|/..if(pb|
|00000bf0| 2d 3e 63 73 43 6f 64 65 | 20 3d 3d 20 2d 31 29 0d |->csCode| == -1).|
|00000c00| 09 09 72 65 74 75 72 6e | 28 64 72 76 72 63 6c 6f |..return|(drvrclo|
|00000c10| 73 65 28 64 63 65 2c 20 | 70 62 29 29 3b 0d 09 0d |se(dce, |pb));...|
|00000c20| 09 2f 2a 20 49 66 20 4b | 69 6c 6c 49 4f 2c 20 6a |./* If K|illIO, j|
|00000c30| 75 73 74 20 72 65 74 75 | 72 6e 20 2a 2f 0d 09 69 |ust retu|rn */..i|
|00000c40| 66 28 70 62 2d 3e 63 73 | 43 6f 64 65 20 3d 3d 20 |f(pb->cs|Code == |
|00000c50| 31 29 0d 09 09 72 65 74 | 75 72 6e 28 30 29 3b 0d |1)...ret|urn(0);.|
|00000c60| 09 09 09 09 0d 09 2f 2a | 20 69 66 20 6c 61 73 74 |....../*| if last|
|00000c70| 20 70 61 70 52 65 61 64 | 20 66 69 6e 69 73 68 65 | papRead| finishe|
|00000c80| 64 2c 20 74 72 79 20 61 | 6e 6f 74 68 65 72 2e 20 |d, try a|nother. |
|00000c90| 2a 2f 0d 09 69 66 20 28 | 72 73 74 61 74 65 20 3c |*/..if (|rstate <|
|00000ca0| 3d 20 30 29 0d 09 09 70 | 61 70 52 65 61 64 28 70 |= 0)...p|apRead(p|
|00000cb0| 72 65 66 6e 75 6d 2c 20 | 72 62 75 66 66 2c 20 26 |refnum, |rbuff, &|
|00000cc0| 72 73 69 7a 65 2c 20 26 | 72 65 6f 66 2c 20 26 72 |rsize, &|reof, &r|
|00000cd0| 73 74 61 74 65 29 3b 0d | 09 09 09 0d 09 72 65 74 |state);.|.....ret|
|00000ce0| 75 72 6e 28 30 29 3b 0d | 09 7d 0d 0d 2f 2a 20 0d |urn(0);.|.}../* .|
|00000cf0| 20 2a 20 50 72 69 6d 65 | 0d 20 2a 2f 0d 69 6e 74 | * Prime|. */.int|
|00000d00| 31 36 20 64 72 76 72 70 | 72 69 6d 65 28 64 63 65 |16 drvrp|rime(dce|
|00000d10| 2c 20 70 62 29 0d 09 44 | 43 74 6c 45 6e 74 72 79 |, pb)..D|CtlEntry|
|00000d20| 20 2a 64 63 65 3b 0d 09 | 69 6f 50 61 72 61 6d 20 | *dce;..|ioParam |
|00000d30| 2a 70 62 3b 0d 09 7b 0d | 09 69 6e 74 31 36 20 70 |*pb;..{.|.int16 p|
|00000d40| 72 65 73 3b 0d 09 69 6e | 74 31 36 20 77 73 74 61 |res;..in|t16 wsta|
|00000d50| 74 65 3b 0d 09 0d 09 69 | 66 28 28 70 62 2d 3e 69 |te;....i|f((pb->i|
|00000d60| 6f 54 72 61 70 20 26 20 | 30 78 46 46 29 20 3d 3d |oTrap & |0xFF) ==|
|00000d70| 20 61 52 64 43 6d 64 29 | 0d 09 09 72 65 74 75 72 | aRdCmd)|...retur|
|00000d80| 6e 28 72 65 61 64 45 72 | 72 29 3b 09 09 09 09 2f |n(readEr|r);..../|
|00000d90| 2a 20 53 68 6f 75 6c 64 | 20 6e 6f 74 20 68 61 70 |* Should| not hap|
|00000da0| 70 65 6e 20 28 68 61 29 | 20 2a 2f 0d 0d 09 69 66 |pen (ha)| */...if|
|00000db0| 28 28 70 72 65 73 20 3d | 20 70 61 70 57 72 69 74 |((pres =| papWrit|
|00000dc0| 65 28 70 72 65 66 6e 75 | 6d 2c 20 70 62 2d 3e 69 |e(prefnu|m, pb->i|
|00000dd0| 6f 42 75 66 66 65 72 2c | 20 28 69 6e 74 31 36 29 |oBuffer,| (int16)|
|00000de0| 70 62 2d 3e 69 6f 52 65 | 71 43 6f 75 6e 74 2c 20 |pb->ioRe|qCount, |
|00000df0| 30 2c 20 26 77 73 74 61 | 74 65 29 29 20 3d 3d 20 |0, &wsta|te)) == |
|00000e00| 6e 6f 45 72 72 29 0d 09 | 09 7b 0d 09 09 77 68 69 |noErr)..|.{...whi|
|00000e10| 6c 65 28 77 73 74 61 74 | 65 20 3e 20 30 29 0d 09 |le(wstat|e > 0)..|
|00000e20| 09 09 69 66 20 28 72 73 | 74 61 74 65 20 3c 3d 20 |..if (rs|tate <= |
|00000e30| 30 29 0d 09 09 09 09 70 | 61 70 52 65 61 64 28 70 |0).....p|apRead(p|
|00000e40| 72 65 66 6e 75 6d 2c 20 | 72 62 75 66 66 2c 20 26 |refnum, |rbuff, &|
|00000e50| 72 73 69 7a 65 2c 20 26 | 72 65 6f 66 2c 20 26 72 |rsize, &|reof, &r|
|00000e60| 73 74 61 74 65 29 3b 0d | 0d 09 09 70 72 65 73 20 |state);.|...pres |
|00000e70| 3d 20 77 73 74 61 74 65 | 3b 0d 09 09 7d 0d 09 72 |= wstate|;...}..r|
|00000e80| 65 74 75 72 6e 28 70 72 | 65 73 29 3b 0d 09 7d 0d |eturn(pr|es);..}.|
|00000e90| 0d 2f 2a 0d 20 2a 20 53 | 74 61 74 75 73 20 28 69 |./*. * S|tatus (i|
|00000ea0| 6e 6f 70 29 0d 20 2a 2f | 0d 69 6e 74 31 36 20 64 |nop). */|.int16 d|
|00000eb0| 72 76 72 73 74 61 74 75 | 73 28 64 63 65 2c 20 70 |rvrstatu|s(dce, p|
|00000ec0| 62 29 0d 09 44 43 74 6c | 45 6e 74 72 79 20 2a 64 |b)..DCtl|Entry *d|
|00000ed0| 63 65 3b 0d 09 69 6f 50 | 61 72 61 6d 20 2a 70 62 |ce;..ioP|aram *pb|
|00000ee0| 3b 0d 09 7b 0d 09 72 65 | 74 75 72 6e 20 30 3b 09 |;..{..re|turn 0;.|
|00000ef0| 09 09 09 09 09 09 2f 2a | 20 4e 6f 2d 6f 70 20 2a |....../*| No-op *|
|00000f00| 2f 0d 09 7d 0d 00 00 00 | 00 00 00 00 00 00 00 00 |/..}....|........|
|00000f10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f80| 00 00 01 00 00 00 01 16 | 00 00 00 16 00 00 00 46 |........|.......F|
|00000f90| 2a 2a 2a 2a 0d 3b 09 2a | 20 50 41 50 49 6e 74 66 |****.;.*| PAPIntf|
|00000fa0| 63 2e 61 73 6d 20 2a 0d | 3b 09 2a 2a 2a 2a 2a 2a |c.asm *.|;.******|
|00000fb0| 09 50 41 50 64 72 76 72 | 2e 63 02 00 00 00 54 45 |.PAPdrvr|.c....TE|
|00000fc0| 58 54 4b 41 48 4c 01 00 | 00 00 00 00 00 00 00 01 |XTKAHL..|........|
|00000fd0| 00 00 54 45 58 54 4b 41 | 48 4c 01 00 00 00 00 00 |..TEXTKA|HL......|
|00000fe0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ff0| 00 00 9b 39 5f 18 00 00 | 0e 85 00 00 01 5c 45 3a |...9_...|.....\E:|
|00001000| 09 54 68 65 20 6e 61 6d | 65 20 27 4c 61 73 65 72 |.The nam|e 'Laser|
|00001010| 57 72 69 74 65 72 27 20 | 69 73 20 61 73 73 75 6d |Writer' |is assum|
|00001020| 65 64 20 68 65 72 65 2e | 20 54 68 65 20 6e 61 6d |ed here.| The nam|
|00001030| 65 20 6f 66 20 74 68 65 | 20 72 65 73 6f 75 72 63 |e of the| resourc|
|00001040| 65 0d 3b 09 66 69 6c 65 | 20 63 61 6e 20 62 65 20 |e.;.file| can be |
|00001050| 64 69 66 66 65 72 65 6e | 74 2e 20 20 53 68 6f 75 |differen|t. Shou|
|00001060| 6c 64 20 6c 6f 6f 6b 20 | 61 74 20 74 68 65 20 53 |ld look |at the S|
|00001070| 54 52 20 72 65 73 6f 75 | 72 63 65 20 69 6e 20 74 |TR resou|rce in t|
|00001080| 00 00 00 04 00 06 00 04 | 00 00 00 0a 00 0a 07 43 |........|.......C|
|00001090| 6f 75 72 69 65 72 00 00 | 01 00 00 00 01 16 00 00 |ourier..|........|
|000010a0| 00 16 00 00 00 46 00 02 | c3 c2 00 5c 00 00 00 1c |.....F..|...\....|
|000010b0| 00 46 00 01 45 54 41 42 | 00 00 00 12 45 46 4e 54 |.F..ETAB|....EFNT|
|000010c0| 00 00 00 1e 03 ec ff ff | 00 00 00 00 00 02 c3 da |........|........|
|000010d0| 03 eb ff ff 00 00 00 08 | 00 02 c3 d2 00 00 00 00 |........|........|
|000010e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000010f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+